function prepDataHumanGEM = prepHumanModelForftINIT(model, convertGenes, essentialTasksFilePath, rxnsFilePath)
% prepHumanModelForftINIT
%   Generates a "standard" prepData structure from Human-GEM to be used in ftINIT.
%   This function typically takes a couple of hours to run, so we recommend to only 
%   run this once and save the results to a .mat file.
%
%   model                   Either Human-GEM or a GEM derived from Human-GEM,
%                           such as Mouse-GEM.
%   convertGenes            True if the genes should be converted to symbols 
%                           ('CD8A' etc., and not ENSEMBL)
%   essentialTasksFilePath  Path to the metabolicTasks_Essential.txt
%                           file. This file can normally be found under
%                           HumanGEM/data/metabolicTasks/metabolicTasks_Essential.txt
%                           If using for example Mouse-GEM, supply another path.
%   rxnsFilePath            Path to the reactions.tsv
%                           file. This file can normally be found under
%                           HumanGEM/model/reactions.tsv
%                           If using for example Mouse-GEM, supply another path.
%
%   Usage: prepDataHumanGEM = prepHumanModelForftINIT(model, convertGenes, essentialTasksFilePath, rxnsFilePath)
%



%load tasks
taskStruct = parseTaskList(essentialTasksFilePath);
%Spontaneous reactions:
rxns_tsv = importTsvFile(rxnsFilePath);
spont = rxns_tsv.spontaneous;
spontRxnNames = rxns_tsv.rxns(spont == 1);%very few

%remove some reactions often not used from the model to speed up calculations

%drug reactions:
m = removeDrugReactions(model);
%remove all AA triplet rxns, i.e. rxns of the type
%2 H2O[c] + Tryptophanyl-Glycyl-Aspartate[c] <=> aspartate[c] + glycine[c] + tryptophan[c]
%This is only used for import of such compounds, and if you don't have that in your "medium",
%which we usually don't, these are pretty pointless.
AATriplets = getAATripletReactions(m,false);
%length(AATriplets)%735
m = removeReactions(m, AATriplets);

%Remove the duplicate complex I reaction with ROS - it only causes problems to include it
m = removeReactions(m, {'MAR13081'});


%prepare some reactions that can always be on:

%protein reactions creation/degradation

proteinRxns = { ...
    'MAR05155'; ...
    'MAR05156'; ...
    'MAR05161'; ...
    'MAR05167'; ...
    'MAR05168'; ...
    'MAR05169'; ...
    'MAR05170'; ...
    'MAR05171'; ...
    'MAR05172'; ...
    'MAR05174'; ...
    'MAR05260'; ...
    'MAR05262'; ...
    'MAR05264'; ...
    'MAR05266'; ...
    'MAR05267'; ...
    'MAR05268'; ...
    'MAR05269'; ...
    'MAR05270'; ...
    'MAR05271'; ...
    'MAR05273'; ...
    'MAR05275'; ...
    'MAR05277'; ...
    'MAR05279'; ...
    'MAR05281'; ...
    'MAR05283'; ...
    'MAR05291'; ...
    'MAR09817'; ...
    'MAR09818'};

%reactions that just pool metabolites
poolRxns = { ...
    'MAR00011'; ...
    'MAR00012'; ...
    'MAR00477'; ...
    'MAR05233'; ...
    'MAR05234'; ...
    'MAR05238'; ...
    'MAR05239'; ...
    'MAR05243'; ...
    'MAR05244'; ...
    'MAR05247'; ...
    'MAR09022'; ...
    'MAR00015'; ...
    'MAR00016'; ...
    'MAR00017'; ...
    'MAR10033'; ...
    'MAR10035'; ...
    'MAR10036'; ...
    'MAR10037'; ...
    'MAR10038'; ...
    'MAR10062'; ...
    'MAR10063'; ...
    'MAR10064'; ...
    'MAR10065'; ...
    'MAR13082'};


%Radical reactions.
%I have assumed that these are spontaneous, but I don't actually have any proof, so we leave them
%out for now. These could be investigated more - if found spontaneous - set the spontaneous flag instead.
%{
radicalRxns = { ...
    'MAR06605'; ...
    'MAR06606'; ...
    'MAR06607'; ...
    'MAR06611'; ...
    'MAR06608'; ...
    'MAR02445'; ...
    'MAR04552'; ...
    'MAR04553'; ...
    'MAR06456'; ...
    'MAR06457'; ...
    'MAR06459'; ...
    'MAR03168'; ...
    'MAR04007'; ...
    'MAR12125'};
%}

customRxnsToIgnore = unique([proteinRxns;poolRxns]);

prepDataHumanGEM = prepINITModel(m, taskStruct, spontRxnNames, convertGenes, customRxnsToIgnore, 'e');

end
